﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using DataAccess;
using DataService;
using TestProjectController.WCFArticlesService;
using WcfService;



namespace TestProjectController
{
    public class ArticlesController
    {
        private static readonly ArticlesClient ArticlesClient = new ArticlesClient();

        public List<Article> GetAuthorArticles(string authorName)
        {
            return ArticlesClient.GetAuthorArticles(authorName);
        }

        public void DeleteArticle(int id)
        {
            ArticlesClient.RemoveArticle(id);
        }

        public List<Article> GetAllArticles()
        {
            return ArticlesClient.GetAllArticles();
        }

        public Article AddArticleWithAuthor(Article article, string author)
        {
            return ArticlesClient.AddArticleWithAutor(article, author);
            //var articlesService = new ArticlesService(ConfigurationManager.ConnectionStrings["ApplicationServices"].ToString());
            //return articlesService.AddArticleWithAutor(article, author);
        }
    }
}
